<style type="text/css">
    .libtn{margin-right: 10px; padding: 5px 0; cursor: pointer; list-style: none;float: right;}
</style>
<div id="tabs" class="tabs">
<ul>
    <li><a href="#tabs-1">Campos</a></li>
    <?php
        if (is_numeric($model->CMPID)){
            if ($model->TCMP_ID >= 3){
                echo '<li><a href="#tabs-2">Listas Desplegables</a></li>';
            }
            echo '<li><a href="#tabs-3">Alias</a></li>';
        }
    ?>
</ul>
<div id="tabs-1" class="form">

<?php $form = $this->beginWidget('GxActiveForm', array(
	'id' => 'campos-form',
	'enableAjaxValidation' => true,
));
?>
	<p class="note">
		<?php echo Yii::t('app', 'Campos con '); ?> <span class="required">*</span> <?php echo Yii::t('app', ' son requeridos'); ?>.
	</p>
	<?php echo $form->errorSummary($model); ?>
		<div class="row">
		<?php echo $form->labelEx($model,'CMPNOMBRE', array('class'=>'label_info')); ?>
		<?php echo $form->textArea($model, 'CMPNOMBRE', array('maxlength' => 1000, 'class'=>'Ctextarea')); ?>
		<?php echo $form->error($model,'CMPNOMBRE'); ?>
		</div><!-- row -->
		<div class="row">
		<?php echo $form->labelEx($model,'CMPAYUDA', array('class'=>'label_info')); ?>
		<?php echo $form->textArea($model, 'CMPAYUDA', array( 'maxlength'=>'4000', 'class'=>'Ctextarea')); ?>
		<?php echo $form->error($model,'CMPAYUDA'); ?>
		</div><!-- row -->
                <div style=" display: inline;" >
                    <div class="row" style=" width: 49%; float:left;">
                    <?php echo $form->labelEx($model,'TCMP_ID', array('class'=>'label_info')); ?>
                    <?php echo $form->dropDownList($model, 'TCMP_ID', GxHtml::listDataEx(Tiposcampos::model()->findAllAttributes(null, true)), array('class'=>'Ccombo')); ?>
                    <?php echo $form->error($model,'TCMP_ID'); ?>
                    </div><!-- row -->
                    <div class="row" style=" width: 49%; float:right;">
                    <?php echo $form->labelEx($model,'TDT_ID', array('class'=>'label_info')); ?>
                    <?php echo $form->dropDownList($model, 'TDT_ID', GxHtml::listDataEx(Tiposdatos::model()->findAllAttributes(null, true)), array('class'=>'Ccombo')); ?>
                    <?php echo $form->error($model,'TDT_ID'); ?>
                    </div><!-- row -->
                    <div style="clear:both;"></div>
                </div>
                <div style=" display: inline;" >
                    <div id="divGrupos" class="row" style=" width: 54%; float:left;">
                    <?php echo $form->labelEx($model,'GRP_ID', array('class'=>'label_info')); ?>
                    <?php echo $form->dropDownList($model, 'GRP_ID', GxHtml::listDataEx(Grupos::model()->findAllAttributes(null, true)), array('class'=>'Ccombo', 'prompt' =>'')); ?>
                    <?php echo $form->error($model,'GRP_ID'); 
                        echo CHtml::link('<li class="ui-state-default ui-corner-all libtn"  title="Crear nuevo grupo" ><span class="ui-icon ui-icon-plusthick" ></span></li>', array('grupos/create', 'campo'=>$model->CMPID, 'iframe'=>'true', 'width'=>'100%', 'height'=>'100%'), array('title'=>GxHtml::encode(GxHtml::valueEx($model)),'class'=>'pretty_grupo'));
                    ?>
                    </div><!-- row -->
                    <div class="row" style=" width: 46%; float:right;">
                    <?php echo $form->labelEx($model,'CMP_LONGITUD', array('class'=>'label_info')); ?>
                    <?php echo $form->textField($model, 'CMP_LONGITUD', array('maxlength' => 4, 'class'=>'Cnumero')); ?>
                    <?php echo $form->error($model,'CMP_LONGITUD'); ?>
                    </div><!-- row -->
                    <div style="clear:both;"></div>
                </div>
                <div style=" display: inline;" >
                    <div class="row" style=" width: 49%; float:left;">
                    <?php echo $form->labelEx($model,'LABELVISIBLE', array('class'=>'label_info', 'style'=>'float:left;width:70%')); ?>
                    <?php echo $form->checkBox($model, 'LABELVISIBLE'); ?>
                    <?php echo $form->error($model,'LABELVISIBLE'); ?>
                    </div><!-- row -->
                    <div class="row" style=" width: 49%; float:right;">
                    <?php echo $form->labelEx($model,'SOLOLECTURA', array('class'=>'label_info', 'style'=>'float:left;width:80%')); ?>
                    <?php echo $form->checkBox($model, 'SOLOLECTURA'); ?>
                    <?php echo $form->error($model,'SOLOLECTURA'); ?>
                    </div><!-- row -->
                    <div style="clear:both;"></div>
                </div>
                <div class="row tipodato">
		<?php echo $form->labelEx($model,'TIPODATOLISTA', array('class'=>'label_info', 'style'=>'float:left;width:90.1%')); ?>
		<?php echo $form->checkBox($model, 'TIPODATOLISTA'); ?>
		<?php echo $form->error($model,'TIPODATOLISTA'); ?>
		</div><!-- row -->
                <div class="fechaaud" >
                    <div  style="display: inline;" >
                        <div class="row" style=" width: 49%; float:left; text-align: center;">
                        <?php echo $form->labelEx($model,'CMPFECHACREACION', array('class'=>'label_info')); ?>
                        <?php echo $form->textField($model, 'CMPFECHACREACION',array('disabled'=>true, 'class'=>'CfechaT')); ?>
                        <?php echo $form->error($model,'CMPFECHACREACION'); ?>
                        </div><!-- row -->
                        <div class="row" style=" width: 49%; float: right; text-align: center;">
                        <?php echo $form->labelEx($model,'CMPFECHAACTUALIZACION', array('class'=>'label_info')); ?>
                        <?php echo $form->textField($model, 'CMPFECHAACTUALIZACION',array('disabled'=>true, 'class'=>'CfechaT')); ?>
                        <?php echo $form->error($model,'CMPFECHAACTUALIZACION'); ?>
                        </div><!-- row -->
                        <div style="clear:both;"></div>
                    </div>
                </div>

<div class="center-submit">
<?php
echo GxHtml::submitButton(Yii::t('app', 'Guardar'), array('class'=>'add_input'));
?>
</div>
<?php
$this->endWidget();
?>
</div><!-- form -->
<?php
    if (is_numeric($model->CMPID)){
        if ($model->TCMP_ID >= 3){
            $baseUrl = Yii::app()->baseUrl;
            echo '<div id="tabs-2">';
            echo '<div class="edit-pretty" >';
            echo CHtml::link('<label class="puntero">Crear o editar listas desplegables</label>', array('/listasdesplegables/admin', 'campo'=>$model->CMPID, 'iframe'=>'true', 'width'=>'100%', 'height'=>'100%'), array('title'=>GxHtml::encode(GxHtml::valueEx($model)),'class'=>'pretty buttonA'));
            echo '</div>';
            echo '<div class="titulo-lista"><h4>Ordén listas desplegables</h2></div>';
            echo '<div class="order-sort" ><div class="order-a" title="Alfabético ascendente"><img onclick="ajax_div('.$model->CMPID.','. "'A'" .',1);" src="'.$baseUrl.'/img/1333473344_sort-ascend.png" alt="Alfabético ascendente" /></div><div class="order-z" title="Alfabético descendente" ><img onclick="ajax_div('.$model->CMPID.','. "'Z'" .',1);" src="'.$baseUrl.'/img/1333473338_sort-descend.png" alt="Alfabético descendente" /></div><div style="clear:both;"></div></div>';
            CamposController::actioncargar_lista($model->CMPID);
            echo '<div  class="center-submit" >'.GxHtml::button(Yii::t('app', 'Guardar Cambios'), array('class'=>'add_input', 'onclick'=>'save_order(1,'.$model->CMPID.');'))."</div>";
            echo "</div>";
        }
        
        echo '<div id="tabs-3">';
        echo '<div class="edit-pretty" >';
        echo CHtml::link('<label class="puntero">Crear o editar alias</label>', array('/alias/admin', 'campo'=>$model->CMPID, 'iframe'=>'true', 'width'=>'100%', 'height'=>'100%'), array('title'=>GxHtml::encode(GxHtml::valueEx($model)),'class'=>'pretty-alias buttonA'));
        echo '</div>';
        echo "</div>";
        echo '<input id="campo_id" type="hidden" value="'.$model->CMPID.'"/>';
    }
?>
</div>
<div class="dialog-message">
    <p class="dialog-content">
    </p>
</div>